package com.hgkj.cloud.base.service.impl;

import com.hgkj.cloud.base.common.PageInfo;
import com.hgkj.cloud.base.dao.SysDevicesMapper;
import com.hgkj.cloud.base.domain.SysDevices;
import com.hgkj.cloud.base.service.SysDevicesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class SysDevicesServiceImpl implements SysDevicesService {

    @Autowired
    private SysDevicesMapper sysDevicesMapper;

    @Override
    public int deleteByPrimaryKey(Integer id) {
        return sysDevicesMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int insert(SysDevices record) {
        return sysDevicesMapper.insert(record);
    }

    @Override
    public int insertSelective(SysDevices record) {
        return sysDevicesMapper.insertSelective(record);
    }

    @Override
    public SysDevices selectByPrimaryKey(Integer id) {
        return sysDevicesMapper.selectByPrimaryKey(id);
    }

    @Override
    public int updateByPrimaryKeySelective(SysDevices record) {
        return sysDevicesMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKey(SysDevices record) {
        return sysDevicesMapper.updateByPrimaryKey(record);
    }

    @Override
    public int deleteDevice(int id) {
        return sysDevicesMapper.deleteDevice(id);
    }

    @Override
    public List<SysDevices> listAll(String device_code) {
        return sysDevicesMapper.listAll(device_code);
    }

    @Override
    public SysDevices getDeviceByCode(String code) {
        return sysDevicesMapper.getDeviceByCode(code);
    }

    @Override
    public SysDevices getDeviceById(int id) {
        return sysDevicesMapper.getDeviceById(id);
    }

    @Override
    public List<SysDevices> listDeviceByType(String type) {
        return sysDevicesMapper.listDeviceByType(type);
    }

    @Override
    public List<SysDevices> listAllDevices(PageInfo pi, Map<String, Object> map) {
        if(pi != null){
            map.put("currentCount", pi.getCurrentCount());
            map.put("pageSize", pi.getPageSize());
        }
        return sysDevicesMapper.listAllDevices(map);
    }

    @Override
    public List<SysDevices> listAllReportDevices(Map<String, Object> map) {
        return sysDevicesMapper.listAllReportDevices(map);
    }

    @Override
    public List<SysDevices> listAllDevicesBackend(PageInfo pi, Map<String, Object> map) {
        if(pi != null){
            map.put("currentCount", pi.getCurrentCount());
            map.put("pageSize", pi.getPageSize());
        }
        return sysDevicesMapper.listAllDevicesBackend(map);
    }

    @Override
    public long listAllDevicesCount(Map<String, Object> map) {
        return sysDevicesMapper.listAllDevicesCount(map);
    }

    @Override
    public long listAllDevicesCountBackend(Map<String, Object> map) {
        return sysDevicesMapper.listAllDevicesCountBackend(map);
    }

    @Override
    public List<Map<String, Object>> getAllDeviceList(Map<String, Object> map) {
        return sysDevicesMapper.getAllDeviceList(map);
    }

    @Override
    public List<SysDevices> getGroupDeviceList(Map<String, Object> map) {
        return sysDevicesMapper.getGroupDeviceList(map);
    }

}
